/* ****************************************************************
   ****************************************************************
   * Com++ Professional (c) 2009 C++ World
   * http://www.cplusplusworld.com/ mailto:compp@cplusplusworld.com
   ****************************************************************
   ****************************************************************
*/

#ifndef _DIRENTRY_H
#define _DIRENTRY_H

#include <string>
#include "SysPlusPlus/ComException.h"
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>

#include "File.h"

namespace compp {
class DirEntry {

public:

	DirEntry(const struct dirent & Entry  );
	DirEntry();

	DirEntry(const unsigned int Inode  );
	DirEntry( const std::string & Path );

	void setPath(const std::string & Path);
	virtual ~DirEntry();

	static bool lessName ( const compp::DirEntry & LeftEntry, const compp::DirEntry & RightEntry  ) ;
	static bool greaterName ( const compp::DirEntry & LeftEntry, const compp::DirEntry & RightEntry  ) ;


	const bool isDirectory () const;
	const bool isRegularFile () const;
	const bool isCharDevice () const;
	const bool isBlockDevice () const;
	const bool isFIFO () const;
	const bool isSocket () const;	
	const bool isSymLink () const;	

	static bool Exist ( const std::string & Path );

	
	const std::string getName () const;
	const int getInode () const;	
	const int getAccessTime() const;
	const int getChangeTime() const;
	const int getLastModificationTime() const;
	const int getSize() const;
	const int getUid() const;
	const int getGid() const;
	const int getNumLinks() const;

	compp::File * getFile ();

protected:
	
	std::string Name;
	int Inode;
	struct stat StatStructure;

};
}
#endif


